<template>
	<view class="container">
		<scroll-view scroll-y class="content" v-if="list.length" @scrolltolower="scrolltolower">
			<view class="list" v-for="(item,index) in list" :key="item.id">
				<view class="head">
					<text class="order">订单编号: {{item.order_no}}</text>
					<text class="status" :class="[item.status==0?'checking':'pass']">{{item.status==0?'未结算':'已结算'}}</text> 
				</view>
				<view class="detail">
					<view class="left">
						<text class="address">{{item.mark}}</text>
						<text class="time">{{item.create_at}}</text>
					</view>
					<view class="right">
						+{{item.price}}
					</view>
				</view>
			</view>
			<u-loadmore :status="status" />
		</scroll-view> 
		<view class="empty" v-else>
			<u-empty icon-size="240" text="暂没有任何数据" font-size="42"></u-empty>
		</view>
	</view>
</template>
<script>
	import service from '@/store/service.js';
	export default {
		data() {
			return {
				status: 'loadmore',
				list: [],
				page: 1,
				limit: 15,
				total: 0,
				type:0,
			};
		},
		methods: {
			scrolltolower(){
				this.loadmore()
			},
			// 分红记录
			getRewardLog() {
				this.$http.post(service.api.profile.getAgentRewardLog, {
					page: this.page,
					limit: this.limit,
					status:this.type
				}).then(res => {
					console.log(res);
					if (res.code === 1) {
						this.list = res.data.data
						this.total = res.data.total
					} else {
						this.$api.msg(res.info)
					}
				})
			},
			loadmore() {
				if (this.total > this.list.length) {
					this.page=++this.page
					this.$http.post(service.api.profile.getAgentRewardLog, {
						page: this.page,
						limit: this.limit,
						status:this.type
					}).then(res => {
						if (res.code === 1) {
							this.list = this.list.concat(res.data.data)
						} else {
							this.$api.msg(res.info)
						}
					})
				} else {
					this.status = 'nomore'
				}
			}
		},
		onLoad(params) {
			this.type = params.type
			console.log(this.type);
			this.getRewardLog(this.type)
		},
	}
</script>
<style lang="less">
	/deep/ .u-load-more-wrap {
		background-color: transparent !important;
	}
	/deep/ .u-more-text {
		background-color: transparent !important;
	}
	.container {
		//#ifndef H5
		height: 100vh;
		//#endif
		//#ifdef H5
		height: calc(100vh - 88rpx);
		//#endif
		overflow: auto;
		.content {
			height: 100%;
			width: 100%;
			.list {
				padding: 0 20rpx;
				height: 180rpx;
				width: 100%;
				background-color: #FFFFFF;
				margin-bottom: 20rpx;

				.head {
					font-size: 26rpx;
					font-weight: 600;
					height: 66rpx;
					line-height: 66rpx;
					border-bottom: 1rpx solid #EEEEEE;
					display: flex;
					justify-content: space-between;

					>.order {
						font-size: 28rpx;
					}

					>.status {
						font-weight: 500;

					}

					.checking {
						color: #F8124A;
					}

					.pass {
						color: green;
					}
				}

				.detail {
					display: flex;
					align-items: center;
					justify-content: space-between;

					.left {
						display: flex;
						flex-direction: column;

						.addres {}

						.time {
							color: rgba(0, 0, 0, .6);
							font-size: 26rpx;
						}
					}

					.right {
						font-size: 30rpx;
						font-weight: 600;
						color: red;
					}

				}
			}
		}
		.empty{
			padding-top: 240rpx;
		}
	}
</style>
